package com.lz.sports.bean

import androidx.room.Embedded
import androidx.room.Relation
import com.lz.library.extension.resString
import com.lz.sports.R

class ExamSignInWithInfo : QueryData {

    //考生信息
    @Embedded
    var examSignIn: ExamSignIn? = null

    //考生项目成绩表
    @Relation(
        parentColumn = "examineeId",
        entityColumn = "id"
    )
    var examinee: Examinee? = null

    fun isInvalid(): Boolean = examSignIn == null || examinee == null

    override fun type(): Int = R.string.signIn

    override fun time(): String = examSignIn!!.signInTime()

    override fun project(): String = ""

    override fun result(): String = ""

    override fun name(): String = examinee!!.studentName

    override fun sex(): String = (if (examinee!!.isMale()) R.string.male else R.string.female).resString()

    override fun examineeNo(): String = examinee!!.examineesNo

    override fun examineeInfo(): Examinee = examinee!!

    override fun toString(): String {
        return "ExamSignInWithInfo(examSignIn=$examSignIn, examinee=$examinee)"
    }
}